public class Numbers
{
   /**
      Counts the number of 7s in a given number
      @param num a number >= 0
      @return the number of digits in num that are 7
   */
   public static int countSevens(int num)
   {
      int n=0;
      while(num!=0){
         if(num%10==7)
            n++;
         num/=10;
      }
      return n;
   }
}